package collection1;

import java.sql.SQLOutput;
import java.util.*;
import java.util.concurrent.Callable;

public class CollectionDe {
    public static void main(String[] args) {
        /*
        Collection c = new ArrayList();
        c.add(new point1(1,2));
        c.add(new point1(3,4));
        c.add(new point1(5,6));
        c.add(new point1(7,8));
        c.add(new point1(9,0));
        c.add(new point1(1,2));
        System.out.println(c);

        point1 p = new point1(1,2);
        boolean contains = c.contains(p);
        System.out.println(contains);

        c.remove(p);
        System.out.println(c);

        Collection cc = new ArrayList();
        point1 pp = new point1(1,2);
        cc.add(pp);

        System.out.println(pp);
        System.out.println(cc);

        pp.setX(100);
        System.out.println(pp);
        System.out.println(cc);
        */
        /*
        Collection c1 = new ArrayList();
        c1.add("java");
        c1.add("c++");
        c1.add(".net");
        System.out.println(c1);

        Collection c2 = new ArrayList();
        c2.add("android");
        c2.add("ios");
        c2.add("java");
        System.out.println(c2);

        c1.addAll(c2);
        System.out.println(c2);

        Collection c3 = new ArrayList();
        c3.add("c++");
        c3.add("android");
        c3.add("php");
        System.out.println(c3);

        c1.retainAll(c3);
        System.out.println(c1);
        System.out.println(c3);

        c1.removeAll(c3);
        System.out.println(c1);
        System.out.println(c3);
         */
/*
        Collection c = new ArrayList();
        c.add("one");
        c.add("#");
        c.add("two");
        c.add("#");
        c.add("three");
        c.add("#");
        c.add("four");
        c.add("#");
        c.add("five");
        System.out.println(c);

        Iterator str = c.iterator();
        while (str.hasNext()){
            String it = (String)str.next();
            System.out.println(it);
            if ("#".equals(it)){
                str.remove();
            }
        }
        System.out.println(c);

 *//*
        String[] array ={"one","two","four","five"};
        for(int i=0;i<array.length;i++){
            System.out.println(array[i]);
        }
        for (String str: array){
            System.out.println(str);
        }
        Collection c = new ArrayList();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        Iterator it = c.iterator();
        while (it.hasNext()){
            String str = (String) it.next();
            System.out.println(str);
        }
        for (Object obj:c){
            String  str = (String) obj;
            System.out.println(str);
        }*/
        /*
        Collection<point1> c= new ArrayList<>();
        c.add(new point1(1,2));
        c.add(new point1(3,4));
        c.add(new point1(5,6));
        c.add(new point1(7,8));

        Iterator<point1> it = c.iterator();
        while (it.hasNext()){
            point1 p = it.next();
            System.out.println(p);
        }
        for (point1 p :c){
            System.out.println(p);
        }
         */
        /*
        Collection<String> c = new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        System.out.println(c);

        String[] array = c.toArray(new String[5]);
        System.out.println(Arrays.toString(array));
        */
        /*
        String [] array = {"one","two","three","four","five"};
        System.out.println(Arrays.toString(array));

        List<String> list = Arrays.asList(array);
        System.out.println(list);
        array[1] = "six";
        System.out.println(Arrays.toString(array));

        list.set(2,"seven");
        System.out.println(Arrays.toString(array));
        System.out.println(list);*/

        /*
        Collection c= new ArrayList();
        c.add(new point1(1,2));
        c.add(new point1(3,4));
        c.add(new point1(5,6));
        c.add(new point1(7,8));
        c.add(new point1(9,0));
        c.add(new point1(1,2));
        System.out.println(c);

        point1 p = new point1(1,2);
        boolean contains = c.contains(p);
        System.out.println(contains);

        c.remove(p);
        System.out.println(c);

        Collection cc = new ArrayList();
        point1 pp = new point1(1,2);
        cc.add(pp);
        System.out.println(pp);
        System.out.println(cc);

        pp.setX(100);
        System.out.println(pp);
        System.out.println(cc);

        Collection c1 = new ArrayList();
        c1.add("java");
        c1.add("c++");
        c1.add(".net");
        System.out.println(c1);

        Collection c2 = new ArrayList();
        c2.add("android");
        c2.add("ios");
        c2.add("java");
        System.out.println(c2);
        Collection c3 = new ArrayList();
        c3.add("c++");
        c3.add("android");
        c3.add("php");
        System.out.println(c3);
        boolean a =c1.containsAll(c3);
        System.out.println(a);
        */
        /*
        Collection c = new ArrayList();
        c.add("one");
        c.add("#");
        c.add("two");
        c.add("#");
        c.add("three");
        c.add("#");
        c.add("four");
        c.add("#");
        c.add("five");
        System.out.println(c);

        Iterator it = c.iterator();
        while (it.hasNext()){
            String str = (String) it.next();
            System.out.println(str);
            if ("#".equals(str)){
                it.remove();
            }
        }
        System.out.println(c);*/
        /*
        String[] array = {"one","two","three","four","five"};
        for (int i=0;i<array.length;i++){
            System.out.println(array[i]);
        }
        for (String str: array){
            System.out.println(str);
        }

        Collection b = new ArrayList();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        Iterator it = c.iterator();
        while (it.hasNext()){
            String str = (String) it.next();
            System.out.println(str);
        }
        for (Object obj: c){
            String str = (String) obj;
            System.out.println(str);
        }
         */
        /*
        Collection<point1> c= new ArrayList<>();
        c.add(new point1(1,2));
        c.add(new point1(3,4));
        c.add(new point1(5,6));
        c.add(new point1(7,8));

        Iterator<point1> it = c.iterator();
        while (it.hasNext()){
            point1 p = it.next();
            System.out.println(p);
        }

        for (point1 p:c){
            System.out.println(p);
        }
        */
        /*
        Collection<String> c = new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        System.out.println(c);

        String[] array = c.toArray(new String[5]);
        System.out.println(array);
        */
        /*
        String[] array ={"one","two","three","four","five"};
        System.out.println(Arrays.toString(array));

        List<String > list = Arrays.asList(array);
        System.out.println(list);

        array[1] = "six";
        System.out.println(Arrays.toString(array));
        System.out.println(list);

        list.set(2,"seven");
        System.out.println(Arrays.toString(array));
        System.out.println(list);
         */
        Collection c= new ArrayList();
        c.add(new point1(1,2));
        c.add(new point1(3,4));
        c.add(new point1(5,6));
        c.add(new point1(7,8));
        c.add(new point1(9,0));
        System.out.println(c);

        point1 p = new point1(1,2);
        boolean contains =c.contains(p);
        System.out.println(contains);

        c.remove(p);
        System.out.println(c);












    }
}
